<?php include "coresection/connection.php";?>
<?php include "coresection/checkSession.php";?>
<?php include "coresection/order-list.php";?>
<?php include "coresection/department-list.php"?>
<?php include "coresection/search-admin.php";?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php include 'modules/head.php'; ?>
    <script type="text/javascript" src="js/jquery.PrintArea.js"></script>
</head>

<body>
<?php include 'modules/topbar.php'; ?>

<div class="setup_area">
    <?include 'modules/sidebar-admin.php'?>

    <div class="header">
        <h1>订单统计</h1>
        <?php include 'modules/header.php'; ?>
    </div>


    <div class="content_area">


<div class="main">

    <form action="" method="post" autocomplete="off" enctype="multipart/form-data">
        部门：<select name="depart" class="depart">
            <option value="all">全部</option>
            <? for($n=0;$n<count($departmentStr);$n++){ ?>
                <option value="<?echo $departmentStr[$n]?>"><?echo $departmentStr[$n]?></option>
            <? } ?>
        </select>
     姓名：<select name="selectName" class="selectName">
            <option value="all">全部</option>
            <? for($u=0;$u<count($admin_user_name);$u++){ ?>
                <option  value="<?echo $admin_user_name[$u]?>" data-dapart="<?echo $admin_department[$u]?>"><?echo $admin_user_name[$u]?></option>
            <? } ?>
        </select> 
        
  <br />
<span style="font-size:10px; color:red">*注意，部门和姓名只能选择一个，否则当部门和姓名不对应的时候结果为0</span><br />
        
        <div style="margin-top: 10px; height: 1px;"></div>
        就餐时间：<select name="year">
            <option value="<?echo date("Y",time())?>"><?echo date("Y",time())?></option>
            <option value="<?echo date("Y",time())-1?>"><?echo date("Y",time())-1?></option>
        </select>
        年
        <select name="month">
            <option value="01" class="month_1">01</option>
            <option value="02" class="month_2">02</option>
            <option value="03" class="month_3">03</option>
            <option value="04" class="month_4">04</option>
            <option value="05" class="month_5">05</option>
            <option value="06" class="month_6">06</option>
            <option value="07" class="month_7">07</option>
            <option value="08" class="month_8">08</option>
            <option value="09" class="month_9">09</option>
            <option value="10" class="month_10">10</option>
            <option value="11" class="month_11">11</option>
            <option value="12" class="month_12">12</option>
        </select>
        月
        <select name="days">
            <option value="0">全部</option>
            <option value="01">01</option><option value="02">02</option><option value="03">03</option>
            <option value="04">04</option><option value="05">05</option><option value="06">06</option>
            <option value="07">07</option><option value="08">08</option><option value="09">09</option>
            <option value="10">10</option><option value="11">11</option><option value="12">12</option>
            <option value="13">13</option><option value="14">14</option><option value="15">15</option>
            <option value="16">16</option><option value="17">17</option><option value="18">18</option>
            <option value="19">19</option><option value="20">20</option><option value="21">21</option>
            <option value="22">22</option><option value="23">23</option><option value="24">24</option>
            <option value="25">25</option><option value="26">26</option><option value="27">27</option>
            <option value="28">28</option><option value="29">29</option><option value="30">30</option>
            <option value="31">31</option>
        </select>
        日
        <select name="ats">
            <option value="0">全部</option>
            <option value="1">早</option>
            <option value="2">午</option>
            <option value="3">晚</option>
        </select>
        餐
        <div style="margin-top: 10px; height: 1px;"></div>
        <input type="submit" value="查看"/>
    </form>
    <div class="printArea <?if($_SESSION['userterm']==1){?>caiwuShow<?}?>">
        <p><b><?echo $reStr?></b> 共<b style="color: #F00;"><?echo $sum?></b>条订餐记录<?if($_SESSION['userterm']==1){?> 共<b style="color: #F00;" class="orderPriceB"></b>元<?}?></p>
        <ul class="caise"></ul>
        <table cellspacing="0" cellpadding="0" border="0" class="checkTable layui-table admin_list_table">
            <thead>
            <tr>
                <td>用餐日期</td>
                <td>订餐会员号</td>
                <td>订餐人</td>
                <td>早/午/晚餐</td>
                <td style="display:none">份数</td>
                <td>总额</td>
                <td class="hide" style="display:none">单价</td>
                <td class="hide" style="display:none">总价</td>
            </tr>
            </thead>
            <tbody>
            <?php for($i=0;$i<$sum;$i++){?>
            
            
             <?
            if( ($search_user[$i]==$search_user[($i-1)]) && ($search_at[$i]==$search_at[($i-1)]) && ($search_date[$i]==$search_date[($i-1)]) )
			{
			   $same_hide_tr="style='display:none'";
			}
			else
			{
				$same_hide_tr="";
			}
			
			?>
      
            
                <tr <? echo $same_hide_tr ?>>
                    <td><?echo $search_date[$i]?></td>
					
                    <td><? echo $search_user[$i]; ?></td>
					
                    <td><? echo  $search_user_name[$i] ;  ?> </td>
                   
				   <td><?switch($search_at[$i]){
                            case 1:
                                echo "早餐";
                                break;
                            case 2:
                                echo "午餐";
                                break;
                            case 3:
                                echo "晚餐";
                                break;
                        }
                        ?></td>
                    <td style="display:none" class="productId productId_<?echo $search_id[$i]?>" data-id="productId_<?echo $search_id[$i]?>"><?echo $search_name[$i]?></td>
                   
                    <td > <?echo select_count_meal_price($search_user[$i],$search_date[$i],$search_at[$i]) ?> </td>
                    
                    <td class="orderPriceTd hide" style="display:none"><?echo $search_price[$i]?>select_count_meal_price</td>
                </tr>
            <? } ?>
            </tbody>
        </table>
    </div>
</div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
        <?php include 'modules/footer.php'; ?>
</body>
</html>